<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div.top{
            height: 100px;
            border: 1px solid red;
        }
        div.bottom div{
            float: left;
        }
        div.left{
            width: 200px;
            border: 1px solid black;
        }
        div.left p{
            background-color: #ccc;
            text-align:center;
            height: 50px;
            line-height:50px;
            width: 100px;
            margin: 20px auto;
            border-radius: 30px;
        }
        div.left p:hover{
            cursor: pointer;
        }
        div.right{
            border: 1px solid blue;
        }
    </style>
    <script src="./jquery-3.5.0/jquery-3.5.0.js"></script>
    <script>
        $(function(){
            //1.页面加载，设置侧边栏高度
            var height=$(window).height()-120;
            var width=$(window).width()-220;

            $("div.left").css("height",height);
            $("div.right").css("height",height);
            $("div.right").css("width",width);
            //2.给侧边栏按钮绑定事件
            $("p").click(function(){
                //5.取消所有按钮的样式
                $('p').css("background-color","#ccc")
                //6.给当前点击按钮添加样式
                $(this).css("background-color","pink")
                var text=$(this).text();
                var url='./'+text+'.html';
                console.log(url);
                //3.加载对应按钮的子页面
                $('.right').load(url)
                // if(text=='首页'){
                // }else if(){}
            })
            //4.模拟点击首页事件
            $("p:first-child").trigger("click");


        })
    </script>
</head>
<body>
    <div class="top"></div>
    <div class="bottom">
        <div class="left">
            <!-- p标签模拟按钮 -->
            <p>首页</p>
            <p>学生管理</p>
            <p>教师管理</p>
            <p>选课管理</p>
        </div>
        <div class="right">
            <!-- 加载服务器端的html -->
        </div>
    </div>
    
</body>
</html>